Skip to content

feat: add single request parameter support for RestTemplate - #1278

Open
przemektrzaskala wants to merge 1 commit into
Backbase:mainfrom
przemektrzaskala:feat/resttemplate-single-parameter-request
Open

feat: add single request parameter support for RestTemplate#1278
przemektrzaskala wants to merge 1 commit into
Backbase:mainfrom
przemektrzaskala:feat/resttemplate-single-parameter-request

Conversation

@przemektrzaskala

@przemektrzaskala przemektrzaskala commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Adds useSingleRequestParameter support to the Java RestTemplate generator.

When enabled, BOAT generates a static *Param inner class and corresponding overloads for operations with multiple parameters. Existing positional-argument methods are preserved for backward compatibility.

Changes

  • Add RestTemplate template support for useSingleRequestParameter
  • Generate *Param classes for multi-parameter operations
  • Keep existing positional overloads unchanged
  • Do not generate parameter objects for operations with zero or one parameter
  • Add regression tests for enabled and disabled configurations
  • Document the option in the Maven plugin README

Example configuration:

<configOptions>
    <useSingleRequestParameter>true</useSingleRequestParameter>
</configOptions>

Testing

  • mvn clean verify -Dgpg.skip
  • Validated the generated RestTemplate client with the option enabled and disabled
  • Verified that existing positional methods remain unchanged
  • Verified that *Param overloads are generated for multi-parameter operations
  • Verified that single-parameter operations remain unchanged

@jjjasper jjjasper left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for reviewing only now...

);
{{#allParams}}
sb.append(" {{paramName}}: ")
.append(toIndentedString({{paramName}}))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan of multi-line toString implementations that potentially leak PII into logfiles etc.


### Single request parameter

When enabled, BOAT generates a `*Param` inner class for each multi-parameter API method alongside

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "alongside"? Replacing the sometimes long list of parameters with a single object will make code more readable and avoid engineers mixing the two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants